#include <stdlib.h>
#include "rtos_global.h"
#include "rtos_classes.h"
#include "RTX.cpp"

void KB_iproc()
{
mmap_ptr = mmap((caddr_t) 0,bufsize,MAP_SHARED,fid,(off_t) 0);
    if (mmap_ptr == MAP_FAILED){
        printf("Damn, mmap didn't work =(");
        in_die(0);
    }
    in_mem_p = (inputbuf *) mmap_ptr;
  
MsgEnv* envelope=receive_message();
for(int i=0;i<inputbuf->length;i++)
    MsgEnv->msg_data[i]=inputbuf->indata[i];
envelope->target_pid=envelope->sender_pid;
envelope->sender_pid=KB;//KB_iproc
send_message(envelope);

//remove message pointer from Q

}

void CRT_iproc()
{
mmap_ptr = mmap((caddr_t) 0,bufsize,MAP_SHARED,fid,(off_t) 0);
    if (mmap_ptr == MAP_FAILED){
        printf("Damn, mmap didn't work =(");
        in_die(0);
    }
    out_mem_p = (outputbuf *) mmap_ptr;

int i;
while(out_mem_p->indata[i]!=�\r�){
printf('%c',out_mem_p->indata[i]);
	i++;
}

//switch to process P

}
